var express = require('express');
var router = express.Router();
var mysql = require('mysql');

var connection = mysql.createConnection({
    host: '192.168.23.1',
    port: 3306,
    user: 'root',
    password: 'root',
    database: 'mydb'

});

/* GET home page. */
router.get('/looknews', function(req, res, next) {
    // res.render('index', { title: 'Express' });
    connection.query('SELECT * FROM `news`', function(err, rows, fw) {
        if (err) {
            console.log(err);
        } else {
            console.log(rows);
            res.send(rows);

        }
    })
});

module.exports = router;